import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)


export default new Vuex.Store({
	state:{  //公用数据
		cityname:localStorage.city || '上海'
	},
	// actions:{
	// 	changeCity(ctx,city){
	// 		console.log(ctx)
	// 		ctx.commit('changeCityname',city);
	// 	}
	// },
	mutations:{
		changeCityname(state,city){
			state.cityname=city;
			localStorage.city=city;
		}
	}
})